package LC;

public class LC845 {
    public int num(int A,int B){
        while (B==0&&A==0){
            return 0;
        }
        while (B==1){
            return A;
        }
        if(B>0&&B%2==0){
        return num(A<<1,B/2);
        }
        else if(B<0&&B%2==0){
        return num(A<<1,B/2);
        }
        else {
            return num(A<<1,B/2)+A;
        }
    }
    public static void main(String[] args) {
        LC845 l=new LC845();
        System.out.println(l.num(4,-4));
    }
}
